package ch.bfh.java.directorysynchronizer.presentation.Frame;

import java.awt.FlowLayout;

import javax.swing.JPanel;

import ch.bfh.java.directorysynchronizer.presentation.actionlisteners.StartSynchronizeButtonListener;
import ch.bfh.java.directorysynchronizer.presentation.actionlisteners.StopSynchronizeButtonListener;
import ch.bfh.java.directorysynchronizer.presentation.items.Workbench;

public class StartStopPanel extends JPanel
{

	/**
     * 
     */
	private static final long serialVersionUID = 1L;

	private Workbench workbench;

	public StartStopPanel(Workbench wb)
	{

		this.workbench = wb;

		this.setPreferredSize(workbench.getStartStopPanelDimension());

		this.setLayout(new FlowLayout());

		workbench.getStartSynchronizingButton().setText("Start synchronizing");
		workbench.getStopSynchronizingButton().setText("Stop synchronizing");
		
		//set on enabled while synchronizing
		workbench.getStopSynchronizingButton().setEnabled(false);
		
		this.workbench.getStartSynchronizingButton().addActionListener(new StartSynchronizeButtonListener(workbench));
		this.workbench.getStopSynchronizingButton().addActionListener(new StopSynchronizeButtonListener(workbench));
		
		this.add(workbench.getStartSynchronizingButton());
		this.add(workbench.getStopSynchronizingButton());
	}

}
